<?php
// +----------------------------------------------------------------------
// | 团购商家管理
// +----------------------------------------------------------------------
// | TongBaoChun <501468940@qq.com>
// +----------------------------------------------------------------------
// | 2015/06/23 
// +----------------------------------------------------------------------
include '/var/www/html/new/d/common/header.html';
include '/var/www/html/new/d/common/left.html';
include '/var/www/html/new/d/common/page.php';


if($_SESSION['sid']!=1) exit('权限不足');


$pageSize    = $_REQUEST['pageSize'] ? $_REQUEST["pageSize"]+0:21;
$currentPage = $_REQUEST["currentPage"] ? $_REQUEST["currentPage"]+0:1;
$nowPage     = ($currentPage-1)*$pageSize;
if($_REQUEST['key']){
	$sKey = addslashes(trim($_REQUEST['key']));
	$where = "where m.dname like '%$sKey%'";
}else $where = '';



$rls = array();
$sql = "select count(distinct u.fid),u.fid,u.itime,u.supplierIdentity,u.DockingMode,m.account,m.dname,m.mobile from uu_qunar_use u left join pft_member m on u.fid=m.id $where group by u.DockingMode,u.fid order by u.fid,u.itime desc limit $nowPage,$pageSize";
$GLOBALS['le']->query($sql);
while($row=$GLOBALS['le']->fetch_assoc()) $rls[]=$row;

$count = "select count(id) as c from (select u.id from uu_qunar_use u left join pft_member m on u.fid=m.id group by u.DockingMode,u.fid) as temp_count";
$GLOBALS['le']->query($count);
$GLOBALS['le']->fetch_assoc();
$count = $GLOBALS['le']->f('c');

$GLOBALS['le']->close();
?>
<link type="text/css" rel="stylesheet" href="css/shenghe.css" />
<link rel="stylesheet" type="text/css" href="css/page.css"/>
<style>
.red{color:red}
#refuse{display:none;z-index:100;position: absolute;left: 50%;top: 200px;background: url(images/pkpopup_bg.png) no-repeat; width: 390px;height: 200px;padding: 5px 20px 15px; margin:-100px 0 0 -195px;}
#refuse p{height: 40px;line-height: 40px;font-size: 14px;font-weight: bold;padding: 0 7px;border-bottom: 2px solid #999; margin-bottom:15px;}
#refuse span{ margin-left:15px;}
#msg{ vertical-align:text-top; margin-top:-5px; width:280px; height:80px; padding:4px; margin-bottom:20px;}
.msgbtn{background: url(images/btn23bg2.png) repeat-x;border: 1px solid #FF8000;border-bottom-color: #F55C00;height: 25px;line-height: 23px;-moz-border-radius: 2px;-webkit-border-radius: 2px;border-radius: 2px;color: white;font-weight: bold; padding: 0 10px; cursor:pointer;}
.msgbtn:hover{background: url(images/btn23bg22.png) repeat-x;}
.closeref{cursor:pointer;display: inline-block;float: right;width: 17px;height: 17px;background: url(images/close.png) no-repeat;margin-top: 12px;}
.mar5{ margin:0 55px 0 110px;}
.Search{width:300px;}
</style>
	<div class="wrap">
		<div class="search" id="b_state">
			<div id="idData_wrapper" class="dataTables_wrapper" role="grid">
			  <form action="">
			  <div class="fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix">
				<div id="idData_length" class="dataTables_length">
					<div class="dataTables_filter" id="idData_filter">
						<label>快速查找:
						<input type="text" class="Search" name="key" value="<?=$_REQUEST['key']?>">
						<button type="submit"  id="checkSubmitBtn" class="chkbtn">搜&nbsp;&nbsp;&nbsp;索</button>
						</label>
					</div>
				</div>
			  </div>
			  </form>
				<table id="idData" class="dataTable" aria-describedby="idData_info">
					<thead>
					  <tr class="th" role="row" id="yanse">
						<th class="ui-state-default" role="columnheader" tabindex="0" aria-controls="idData" rowspan="1" colspan="1" style="width: 201px; " aria-sort="descending" aria-label="添加时间: activate to sort column ascending">
						<div class="DataTables_sort_wrapper">添加时间<span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span></div>
						</th>
						<th class="col1 ui-state-default" role="columnheader" tabindex="0" aria-controls="idData" rowspan="1" colspan="1" style="width: 320px; " aria-label="企业名称: activate to sort column ascending"><div class="DataTables_sort_wrapper">企业名称<span class="DataTables_sort_icon css_right ui-icon ui-icon-carat-2-n-s"></span></div></th>
						<th class="ui-state-default" role="columnheader" tabindex="0" aria-controls="idData" rowspan="1" colspan="1" style="width: 84px; " aria-label="账号: activate to sort column ascending"><div class="DataTables_sort_wrapper">账号<span class="DataTables_sort_icon css_right ui-icon ui-icon-carat-2-n-s"></span></div></th>
						<th class="ui-state-default" role="columnheader" rowspan="1" colspan="1" style="width: 134px; " aria-label="联系电话"><div class="DataTables_sort_wrapper">联系电话<span class="DataTables_sort_icon"></span></div></th>
						<th class="ui-state-default" role="columnheader" tabindex="0" aria-controls="idData" rowspan="1" colspan="1" style="width: 200px; " aria-label="商家标识: activate to sort column ascending"><div class="DataTables_sort_wrapper">商家标识<span class="DataTables_sort_icon css_right ui-icon ui-icon-carat-2-n-s"></span></div></th>
						<th class="ui-state-default" role="columnheader" tabindex="0" aria-controls="idData" rowspan="1" colspan="1" style="width: 200px; " aria-label="商家标识: activate to sort column ascending"><div class="DataTables_sort_wrapper">对接商家<span class="DataTables_sort_icon css_right ui-icon ui-icon-carat-2-n-s"></span></div></th>
						
					  </tr>
					</thead>
					<tbody id="tablebody" >
					<?foreach($rls as $v):?>
					  <tr>
						<td class=""><?=$v['itime']?></td>
						<td class=" "><a href=""><?= (mb_strlen($v['dname'], 'utf8')>12) ? mb_substr($v['dname'],0, 12, 'utf8').'...':$v['dname'];?></a> </td>
						<td class=" "><?=$v['account']?></td>
						<td class="coop "><?=$v['mobile']?></td>
						<td class=" "><?=$v['supplierIdentity']?></td>
						<td class=" "><?=$v['DockingMode']==0 ? '去哪儿':'美团';?></td>
					  </tr>
					  <?endforeach;?>
					</tbody>
				 </table>
			  <?page($count,$currentPage,$pageSize);?>
			</div>
		</div>
	</div>
<?include 'common/footer.html';?>